#ifndef RS_VECTOR3_H
#define RS_VECTOR3_H


namespace rs
{

//;class Point3;

//! 3D vector class. (internally 4D vector with w=0)
RS_ALIGN_BEGIN(16)
class Vector3
{
//;	friend class Point3;
//;	friend Point3 operator+(const Vector3& lhs, const Point3& rhs);
//;	friend Point3 operator+(const Point3& lhs, const Vector3& rhs);
//;	friend Vector3 operator-(const Point3& lhs, const Point3& rhs);
//;	friend Vector3 operator*(const Matrix& lhs, const Vector3& rhs);
//;	friend Matrix matrixRotationAxis(const Vector3& v, f32 rad);

public:
	//! constructor.
	Vector3() {}
	Vector3(f32 x, f32 y, f32 z);
	Vector3(const Vector3& rhs);

	// operators.
	Vector3& operator=(const Vector3& rhs);
	Vector3& operator+=(const Vector3& rhs);
	Vector3& operator-=(const Vector3& rhs);
	Vector3& operator*=(const Vector3& rhs);
	Vector3& operator*=(f32 rhs);
	Vector3& operator/=(const Vector3& rhs);
	Vector3& operator/=(f32 rhs);

	//! set all elements.
	void set(f32 x, f32 y, f32 z);

	//! get each element.
	f32 getX() const;
	f32 getY() const;
	f32 getZ() const;

	//! normalize.
	Vector3& normalize();
	//! returns normalized vector.
	Vector3 getNormalize() const;

	//! cross product.
	Vector3& cross(const Vector3& rhs);
	//! returns cross product.
	Vector3 getCross(const Vector3& rhs) const;

	//! dot product.
	f32 dot(const Vector3& rhs) const;
	//! returns dot product.
//;	f32 dot(const Point3& rhs) const;

	//! returns length of vector.
	f32 length() const;
	//! returns square length of vector. faster than length.
	f32 lengthSq() const;

private:
//	union {
//;		__m128	vf;
//		struct {
			f32	x, y, z, w;
//		};
//	};
//	XMFLOAT4A	v_;
} RS_ALIGN_END(16);

// operators.
Vector3 operator+(const Vector3& lhs, const Vector3& rhs);
Vector3 operator-(const Vector3& lhs, const Vector3& rhs);
Vector3 operator*(const Vector3& lhs, const Vector3& rhs);
Vector3 operator*(const Vector3& lhs, f32 f);
Vector3 operator*(f32 f, const Vector3& rhs);
Vector3 operator/(const Vector3& lhs, const Vector3& rhs);
Vector3 operator/(const Vector3& lhs, f32 f);

} // namespace rs

// implementation
#ifdef RS_MATH_USE_C
#include "Vector3_C.h"
#endif

#endif // #ifndef RS_VECTOR3_H
